﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="add_test.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Certificate.add_test" %>

<%@ Import Namespace="DataAccess" %>
<%@ Import Namespace="System.Linq" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<body>
    <% 
        string title = Request.QueryString["title"];
        int time = int.Parse(Request.QueryString["time"]);
        int check = int.Parse(Request.QueryString["check"]);
        string start = Request.QueryString["start"];
        string level = Request.QueryString["level"];
        int active = int.Parse(Request.QueryString["active"]);
        int cer = int.Parse(Request.QueryString["cer"]);
        int admin = int.Parse(Session["admin_id"].ToString());
        bool exam = false;
        if (check == 1)
        {
            exam = true;
        }

        bool show = false;
        if (active == 1)
        {
            show = true;
        }
        
        if (exam == true)
            new TblTestController().Insert(title, cer, level, exam, admin, DateTime.Parse(start), time, show, "");
        else
            new TblTestController().Insert(title, cer, level, exam, admin, null, time, show, "");

        var test = new TblTestController().FetchAll().Where(x => x.TestTitle == title).Last();
    %>
    <li id="<%=test.TestId %>" class="test w3-hover-teal w3-display-container"><%=title%><div class="w3-hide test_id"><%=test.TestId %></div></li>
</body>
</html>
